using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoneyManagerNET.Presentation.ViewModel
{
using Model;
    using MoneyManagerNET.Presentation.ViewModel;

    public class DesignTimeViewModelSupplier
    {
        static DesignTimeViewModelSupplier()
        {

        }

        public static HomeViewModel Home
        {
            get
            {
                var vm = new HomeViewModel();
                return vm;
            }
        }

        public static MainWindowViewModel Main
        {
            get
            {
                var vm = new MainWindowViewModel();
                vm.SelectNode(((IEnumerable<IBankAccount>)vm.BankAccounts).First(), "BankAccount");
                return vm;
            }
        }
        public static BankAccountViewModel BankAccount
        {
            get
            {
                var bank_account = App.Storage.Select<IBankAccount>().FirstOrDefault();
                var vm = new BankAccountViewModel() { Model = bank_account };
                vm.Filter = vm.FilterList[1];
                return vm;
            }
        }

        public static TransactionViewModel Transaction
        {
            get
            {
                var tran = new TransactionViewModel() { Model = App.Storage.Select<ITransaction>().FirstOrDefault() };
                return tran;
            }
        }
        public static CategoryListViewModel Categories
        {
            get
            {
                return new CategoryListViewModel();
            }
        }

        public static AccountListViewModel AccountList
        {
            get
            {

                return new AccountListViewModel() ;
            }
        }


        public static EditAccountViewModel EditAccount
        {
            get
            {
                var baccount = App.Storage.Select<IBankAccount>().FirstOrDefault();
                var vm = new EditAccountViewModel() { Model = baccount };

                return vm;
            }
        }

        public static StockAccountViewModel StockAccount
        {
            get
            {
                var saccount = App.Storage.Select<IStockAccount>().FirstOrDefault();
                return new StockAccountViewModel() { Model = saccount };
            }
        }

        public static ContragentListViewModel Contragent
        {
            get
            {
                var contragents = new ContragentListViewModel();
                contragents.Selected = contragents.Items.First();
                return contragents;
            }
        }

        public static StockInvestmentViewModel StockInvestment
        {
            get
            {
                return new StockInvestmentViewModel() { Model = App.Storage.Select<IStockInvestment>().FirstOrDefault() };
            }
        }


        public static RelocateCategoryViewModel RelocateCategory
        {
            get
            {
                var vm = new RelocateCategoryViewModel();
                var categories = App.Storage.Select<ICategory>().ToList();

                vm.FromCategory = categories[0];
                vm.FromSubCategory = categories[0].SubCategoryList.FirstOrDefault();

                vm.ToCategory = categories[1];
                vm.ToSubCategory = categories[1].SubCategoryList.FirstOrDefault();

                return vm;
            }
        }

        public static RelocateContragentViewModel RelocateContragent
        {
            get
            {
                var vm = new RelocateContragentViewModel();
                var contragents = App.Storage.Select<IContragent>().ToList();

                vm.FromContragent = contragents[0];

                vm.ToContragent = contragents[1];

                return vm;
            }
        }

        public static AssetListViewModel AssetList
        {
            get
            {
                var vm = new AssetListViewModel();

                return vm;
            }
        }

        public static AssetViewModel Asset
        {
            get
            {
                var vm = new AssetViewModel();
                vm.Model = App.Storage.Select<IAsset>().First();
                return vm;
            }
        }

        public static SummaryOfAccountsReportViewModel SummaryOfAccounts
        {
            get
            {
                //var groupList = new List< AccountSummary>();

                //{
                //    var list = new List< AccountSummary>();
                //    list.Add(new  AccountSummary("kassa", 500));
                //    list.Add(new  AccountSummary("donuz", 564));
                //    list.Add(new  AccountSummary("koshlek", 285));
                //    list.Add(new  AccountSummary("yastiq", 364));

                //    var ag = new  AccountSummaryGroup("Bank Account total:", list.ToArray());
                //    groupList.Add(ag);
                //}

                //{
                //    var list = new List< AccountSummary>();
                //    list.Add(new  AccountSummary("MS", 285));
                //    list.Add(new  AccountSummary("NASDAQ", 364));

                //    var ag = new  AccountSummaryGroup("Term Accounts Total   :", list.ToArray());
                //    groupList.Add(ag);
                //}

                //groupList.Add(new  AccountSummary("Stock Investments", 51));
                //groupList.Add(new  AccountSummary("Stock Investments", 6014));


                //var root = new  AccountSummaryGroup("Total balance on all accounts:", groupList.ToArray());

                var vm = new SummaryOfAccountsReportViewModel();
                vm.Execute();
                return vm;//{ RootGroup = root };
            }
        }


        public static SummaryOfStocksReportViewModel SummaryOfStocksReport
        {
            get {
                var vm = new SummaryOfStocksReportViewModel();
                vm.Execute();
                return vm;
            }
        }

        public static ReportShellViewModel ReportShell {
            get
            {
                var vm = new ReportShellViewModel();
                return vm;
            }
        }

        public static StockAccountListViewModel StockAccounList {
            get {
                return new StockAccountListViewModel();
            }
        }
    }
}
